//
//  BaseCell.m
//  Medicine
//
//  Created by laber on 15/5/20.
//  Copyright (c) 2015年 laber. All rights reserved.
//

#import "BaseCell.h"

@interface BaseCell()

@property (nonatomic,strong) UIImageView *touchBack;//点击时的阴影

@end

@implementation BaseCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        
        self.bottonLine = [[UIView alloc] init];
        self.bottonLine.backgroundColor = LINE_COLOR;
        [self.contentView addSubview:self.bottonLine];
        [self.bottonLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.and.trailing.equalTo(self.contentView);
            make.bottom.equalTo(self.contentView.mas_bottom);
            make.height.equalTo(@1);
        }];
    
        self.touchBack = [[UIImageView alloc] initWithImage:[UIImage imageWithColor:BLACK_COLOR Size:CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT) Alpha:0.2]];
        self.touchBack.hidden = YES;
        [self addSubview:self.touchBack];
        [self.touchBack mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
    }
    return self;
}

-(void)initChildViews{}

-(void)makeConstraints{}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [super touchesBegan:touches withEvent:event];
    self.touchBack.hidden = NO;
}

-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
    [super touchesCancelled:touches withEvent:event];
    [self hiddenBack];
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    [super touchesMoved:touches withEvent:event];
    [self hiddenBack];
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    [super touchesEnded:touches withEvent:event];
    [self hiddenBack];
}

-(void)hiddenBack{
    self.touchBack.hidden = YES;
}

@end
